<template>
  <div>
    <detail-banner
    :sightName='sightName'
    :bannerImg='bannerImg'
    :gallaryImgs = 'gallaryImgs'
    ></detail-banner>
    <detail-header></detail-header>
    <detailList :list='list'></detailList>
    <div class="ok"></div>
  </div>
</template>
<script>
import detailBanner from './components/Banner'
import detailHeader from './components/Header'
import detailList from './components/List'
import axios from 'axios'
export default {
  name: 'Detail',
  data () {
    return {
      sightName: '',
      bannerImg: '',
      gallaryImgs: [],
      list: []
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json', {params: {id: this.$route.params.id}})
        .then(this.handleGetDetailSucc)
    },
    handleGetDetailSucc (res) {
      let dataMsg = res.data
      if (dataMsg.ret && dataMsg.data) {
        const data = dataMsg.data
        this.sightName = data.sightName
        this.bannerImg = data.bannerImg
        this.list = data.categoryList
        this.gallaryImgs = data.gallaryImgs
      }
    }
  },
  components: {
    detailBanner,
    detailHeader,
    detailList
  },
  mounted () {
    this.getDetailInfo()
  },
  activated () {
    // this.getDetailInfo()
  }
}
</script>
<style lang="stylus" scoped>
</style>
